<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/header.jsp" %>

<!-- page specific plugin scripts -->
<script type="text/javascript">
var scripts = [null, null];
$('.page-content-area').ace_ajax('loadScripts', scripts, function() {
	$.widget("ui.dialog", $.extend({}, $.ui.dialog.prototype, {
		_title: function(title) {
			var $title = this.options.title || '&nbsp;'
			if( ("title_html" in this.options) && this.options.title_html == true )
				title.html($title);
			else title.text($title);
		}
	}));   
	//角色详细信息
	$('#userDetailIframe').dialog({
		hide:true,
		autoOpen:false,
		width: 700,
		height:600,
		modal:true,
		//bgiframe:true,
		title: "<div class='widget-header'><h4 class='smaller'><i class='ace-icon fa fa-cog green'></i>&nbsp;个人信息</h4></div>",
		title_html: true,
		open: function (event,ui) {
			var flag = $(this).data('btnFlag');
			if(flag == "show"){
				$("#btnPwdModify").show();
				$("#btnPwdUpdate").hide();
				$("#btnModify").show();
				$("#btnSave").hide();
				$("#btnCancle").hide();
				$("#btnClose").show();
				 }else{
				$("#btnPwdModify").hide();
				$("#btnPwdUpdate").hide();
				$("#btnModify").hide();
				$("#btnSave").show();
				$("#btnCancle").show();
				$("#btnClose").show();
				}
        },
		buttons: [

					{
						id: "btnPwdModify",
						html: "<i class='ace-icon fa fa-pencil-square-o bigger-110'></i>&nbsp; 修改密码",
						"class" : "btn btn-purple btn-minier",
						click: function() {
							pwdModify();
						}
					},
					{						
						id: "btnPwdUpdate",
						html: "<i class='ace-icon fa fa-floppy-o bigger-110'></i>&nbsp; 确认修改",
						"class" : "btn btn-success btn-minier",
						click: function() {
							updatePwd();
						}
					},
					/* {
						id: "btnUMenuModify",
						html: "<i class='ace-icon fa fa-pencil-square-o bigger-110'></i>&nbsp; 自定义菜单",
						"class" : "btn btn-primary btn-minier",
						click: function() {
							menuModify();
						}
					}, */
					{
						id: "btnSave",
						html: "<i class='ace-icon fa fa-floppy-o bigger-110'></i>&nbsp; 确认",
						"class" : "btn btn-success btn-minier",
						click: function() {
							save();
						}
					},
					{
						id: "btnCancle",
						html: "<i class='ace-icon fa fa-undo bigger-110'></i>&nbsp; 取消",
						"class" : "btn btn-warning btn-minier",
						click: function() {
							cancle();
						}
					},												
					{
						id: "btnClose",
						html: "<i class='ace-icon fa fa-times bigger-110'></i>&nbsp; 关闭",
						"class" : "btn btn-minier",
						click: function() {
							$(this).dialog("close");
						}
					}				
				]	
			});
	var dataTables;		
			dataTables = $("#uodrList").dataTable({
			     bAutoWidth: false,	
			     "bDestroy":true,
			     "bFilter": false,
			     "bSort": false,
			     "oLanguage":oLanguage,
			     "bAutoWidth": false,
			     "columnDefs": [
								{ "visible": false,  "targets": [ 0 ] }
				               ],
			        "fnDrawCallback" : function(param) {			
			        	$('#uodrList tbody td').each(function(index){
						    $this = $(this);
						    $this.attr("class","td-overflow");
						    $this.attr("style","width:150px;");
						    var titleVal = $this.text();
						    if (titleVal != '') {
						      $this.attr('title', titleVal);
						    }
						});
						
					}  
	});

	var active_class = 'success';
	$('#uodrList').on('click', 'tbody tr' , function(){
		var $row = $(this).closest('tr');	
		if ($row.hasClass(active_class) == false) {
			dataTables.$('tr.' + active_class).removeClass(active_class);
			$row.addClass(active_class);				
		}
	});	
	$('#uodrList').on('dblclick', 'tbody tr' , function(){
		var aData = dataTables.fnGetData(this); 
		if (aData == null) {
			return;
		} 
		showUserDetailList(aData[0]);
	});	

});
function showUserDetailList(userId) {
	$("#userDetailIframe").hide();
	$('#userDetailIframe').load("${ctx}/user/toQueryDetail.do?userId="+userId+"&userFlag=1&"+new Date().getTime(),function(){
		$("#userDetailIframe").show();
		$('#userDetailIframe').data("btnFlag","show").dialog("open");
	});
	
}

</script>
<div class="row" id="updateInfoApply">
	<div class="col-xs-12">
		<!-- PAGE CONTENT BEGINS -->
		<div class="row">
			<div class="col-xs-12">
				<div class="table-header">
					个人信息
				</div>
				<div>
					<table id="uodrList" class="table table-striped table-bordered table-hover" style="table-layout:fixed">
						<thead>
							<tr>
							   <th  style="text-align: center; ">用户ID</th>
							   <th  style="text-align: center;">用户编号</th>
				               <th  style="text-align: center;">用户名</th>
					           <th  style="text-align: center;">所属机构</th>	 
					           <th  style="text-align: center;">是否在职</th>
					          <!--  <th  style="text-align: center;">证件号码</th> -->
					           <th  style="text-align: center;">拥有角色</th>
					           <th  style="text-align: center;">用户状态</th>	
					           <th  style="text-align: center;">操作</th>	
							</tr>
						</thead>


						<tbody>
						    <c:forEach items="${userList }" var="user">
								<tr>
								<td style="display: none">${user.userId}</td>
								<td>${user.userCode}</td>
								<td>${user.userName}</td>
								<td>
								<hw:orgName orgId="${user.orgId}"/>(${user.orgId})
								</td>
								<td>${user.userStatus}</td>
								<%-- <td>${user.cardNo}</td> --%>
								<td>${user.queryRole}</td>
								<td>${user.status}</td>
								<td>
									<div class="hidden-sm hidden-xs action-buttons">
										<a class="blue" href="#" onClick="javascript:showUserDetailList('${user.userId}');"  title="查询详细信息">
											<i class="ace-icon fa fa-search-plus bigger-130"></i>
										</a>
									</div>

									
								</td>
							</tr>	
							</c:forEach>						
						</tbody>
					</table>
				</div>
			</div>
		</div>
		
		<div class="hr hr-18 dotted hr-double"></div>
		
		<!-- PAGE CONTENT ENDS -->
	</div><!-- /.col -->
</div><!-- /.row -->
<div class="row">
  <div id="userDetailIframe"></div>	
</div>

